/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apt.UpdateGroupPaymentBean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apt.connectDB.MyConnect;

/**
 *
 * @author MinhThang
 */
public class update_group_payment_bean extends org.apache.struts.action.ActionForm {
    private String txtStyle;
    private String txtID;
   
    public update_group_payment_bean() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public boolean UpdateGroupPayment(String style,int ID){
        //Update data to GroupPayment table
        Connection conn=null;
        PreparedStatement ps=null;
        String sql="UPDATE GroupPayment SET Style=? WHERE ID=?";
        try{
            conn=MyConnect.getConnection();
            ps=conn.prepareCall(sql);
            ps.setString(1, style);
            ps.setInt(2, ID);
            ps.executeUpdate();
            return  true;
        }catch(Exception e){
            e.printStackTrace();
        }
        return false;
    }

    /**
     * @return the txtStyle
     */
    public String getTxtStyle() {
        return txtStyle;
    }

    /**
     * @param txtStyle the txtStyle to set
     */
    public void setTxtStyle(String txtStyle) {
        this.txtStyle = txtStyle;
    }

    /**
     * @return the txtID
     */
    public String getTxtID() {
        return txtID;
    }

    /**
     * @param txtID the txtID to set
     */
    public void setTxtID(String txtID) {
        this.txtID = txtID;
    }
}
